package com.imooc.utils;



import org.apache.commons.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Utils {

    public static final String getMD5Str(String value) throws NoSuchAlgorithmException {

        MessageDigest md5 = MessageDigest.getInstance("MD5");
        String s = Base64.encodeBase64String(md5.digest(value.getBytes()));
        return s;

    }


  /*  public static void main(String[] args) {
        try {
            System.out.println("获取加密的md5:"+getMD5Str("杨伟乔"));
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
    }*/

}
